<template>
  <!-- 短信日志详情抽屉 -->  
  <div class="sms-pluginSmsLog-detail">
    <el-drawer v-model="isShowDialog" size="80%" direction="ltr">
      <template #header>
        <h4>短信日志详情</h4>
      </template>
      <el-form ref="formRef" :model="formData" label-width="100px">          
        <el-row>        
          <el-col :span="12">          
            <el-form-item label="ID">{{ formData.id }}</el-form-item>          
          </el-col>        
          <el-col :span="12">          
            <el-form-item label="短信平台的类型">{{ formData.smsType }}</el-form-item>          
          </el-col>        
          <el-col :span="12">          
            <el-form-item label="短信的类型">{{ formData.msgType }}</el-form-item>          
          </el-col>        
          <el-col :span="12">          
            <el-form-item label="模板id">{{ formData.templateid }}</el-form-item>          
          </el-col>        
          <el-col :span="12">          
            <el-form-item label="电话号码">{{ formData.mobiles }}</el-form-item>          
          </el-col>        
          <el-col :span="12">          
            <el-form-item label="模板参数">{{ formData.params }}</el-form-item>          
          </el-col>        
          <el-col :span="12">          
            <el-form-item label="发送结果">{{ formData.result }}</el-form-item>          
          </el-col>        
          <el-col :span="12">
            <el-form-item label="发送日期">{{ proxy.parseTime(formData.createdAt, '{y}-{m}-{d} {h}:{i}:{s}') }}</el-form-item>
          </el-col>      
        </el-row>      
      </el-form>
    </el-drawer>
  </div>
</template>
<script lang="ts">
  import { reactive, toRefs, defineComponent,ref,unref,getCurrentInstance,computed } from 'vue';
  import {ElMessageBox, ElMessage, FormInstance,UploadProps} from 'element-plus';  
  import {
    listPluginSmsLog,
    getPluginSmsLog,
    delPluginSmsLog,
    addPluginSmsLog,
    updatePluginSmsLog,    
  } from "/@/api/system/sms/pluginSmsLog";  
  import {
    PluginSmsLogTableColumns,
    PluginSmsLogInfoData,
    PluginSmsLogTableDataState,
    PluginSmsLogEditState
  } from "/@/views/system/sms/pluginSmsLog/list/component/model"
  export default defineComponent({
    name:"ApiV1PluginsSmsPluginSmsLogDetail",
    components:{      
    },
    props:{      
    },
    setup(props,{emit}) {      
      const {proxy} = <any>getCurrentInstance()
      const formRef = ref<HTMLElement | null>(null);
      const menuRef = ref();      
      const state = reactive<PluginSmsLogEditState>({
        loading:false,
        isShowDialog: false,
        formData: {          
          id: undefined,          
          smsType: undefined,          
          msgType: undefined,          
          templateid: undefined,          
          mobiles: undefined,          
          params: undefined,          
          result: undefined,          
          createdAt: undefined,          
          updatedAt: undefined,          
          deletedAt: undefined,          
        },
        // 表单校验
        rules: {          
          id : [
              { required: true, message: "ID不能为空", trigger: "blur" }
          ],          
        }
      });
        // 打开弹窗
        const openDialog = (row?: PluginSmsLogInfoData) => {
          resetForm();
          if(row) {
            getPluginSmsLog(row.id!).then((res:any)=>{
              const data = res.data;              
              state.formData = data;
            })
          }
          state.isShowDialog = true;
        };
        // 关闭弹窗
        const closeDialog = () => {
          state.isShowDialog = false;
        };
        // 取消
        const onCancel = () => {
          closeDialog();
        };
        const resetForm = ()=>{
          state.formData = {            
            id: undefined,            
            smsType: undefined,            
            msgType: undefined,            
            templateid: undefined,            
            mobiles: undefined,            
            params: undefined,            
            result: undefined,            
            createdAt: undefined,            
            updatedAt: undefined,            
            deletedAt: undefined,            
          }
        };        
        return {
          proxy,
          openDialog,
          closeDialog,
          onCancel,
          menuRef,
          formRef,          
          ...toRefs(state),
        };
      }
  })
</script>
<style scoped>  
  .sms-pluginSmsLog-detail :deep(.el-form-item--large .el-form-item__label){
    font-weight: bolder;
  }
  .pic-block{
    margin-right: 8px;
  }
  .file-block{
    width: 100%;
    border: 1px solid var(--el-border-color);
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: var(--el-transition-duration-fast);
    margin-bottom: 5px;
    padding: 3px 6px;
  }
  .ml-2{margin-right: 5px;}
</style>